package de.htwds.mada.todolistDB.model;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "todo_category")
public class TodoCategory {

	public static final String ID_FIELD = "_id"; // primary key
	public static final String TODO_ID_FIELD = "todo_id";
	public static final String CAT_ID_FIELD = "category_id";

	@DatabaseField(columnName = ID_FIELD, generatedId = true)
	private int _id;

	@DatabaseField(columnName = TODO_ID_FIELD, foreign = true, foreignAutoRefresh = true, uniqueCombo = true)
	private Todo todo;

	@DatabaseField(columnName = CAT_ID_FIELD, foreign = true, foreignAutoRefresh = true, uniqueCombo = true)
	private Category category;

	public TodoCategory() {
	}

	public TodoCategory(Todo todo, Category category) {
		this.todo = todo;
		this.category = category;
	}

	public Todo getTodo() {
		return todo;
	}

	public Category getCategory() {
		return category;
	}

	public void setTodo(Todo todo) {
		this.todo = todo;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public String toString() {
		return category.toString();
	}

	public String toStringComplete() {
		return "Todo: " + todo + ", Category: " + category;
	}
}
